import Json from './static/Json.js' //测试用数据
export const http = (url,data,callback,type)=>{
	uni.showLoading({
		title: '加载中...',
		mask: true,
	})
	setTimeout(function () {
	    uni.hideLoading();
	}, 10000);
	uni.request({
		method: type ||'POST',
		url: Json.baseUrl + url,
		data: data,
		success: (res) => {
			if(res.data.resultCode=='000000'){
				callback&&callback(res.data)
			}else if(res.data.resultCode=='200009') {
				uni.showToast({
					title:res.data.resultInfo,
				})
				uni.redirectTo({
					url: '/pages/login/login'
				})
			}else{
				setTimeout(function () {
					uni.showToast({
						title:res.data.resultInfo || '请求失败',
						icon: 'none'
					})
				}, 2000);
				
			}
		}
	})
}